<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // console.log(num); // undefined
        // var num = 1;

        // fun();// 报错
        // var fun = function() {
        //     console.log('fun');
        // }

        // fun2();// 打印 fun2
        // function fun2() {
        //     console.log('fun2');
        // }

        f1();
        console.log(b);
        console.log(c);
        console.log(a);
        
        function f1() {
            console.log(a); // 报错 a未定义
            // console.log(b);
            // console.log(c);
            var a = b = c = 9;// 相当于 var a = 9; b = a; c = a; b和c是全局变量
        }
        // 打印 9 9 9 9 9 报错
    </script>
</body>
</html>